// guess.cpp.  Maggie Johnson
// Description: A guessing game where the player guesses
// the secret number.

#include <iostream>
#include <time.h>
using namespace std;

int main ()
{
  int random_number, guess;

  srand (time(NULL));

  random_number = rand() % 100 + 1;

  do {
  	  cout << "Guess our number (1 to 100) ";
	  if (!(cin >> guess)) {
		cout << "Please enter only numbers" << endl;
		} else {
		if (random_number < guess)
		  cout << "The secret number is lower than " << guess << endl;
		else if (random_number > guess) 
		  cout << "The secret number is higher than " << guess << endl;
		else cout << "You guessed it: " << random_number << endl;
	  }
  } while (guess != random_number);
  cout << "random: " << random_number << endl;
	  return 0;
}
